<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
{% comment %}
Copyright 2012, Le Tuan Anh (tuananh.ke@gmail.com)
This file is part of VisualKopasu.
VisualKopasu is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by 
the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.
VisualKopasu is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License 
along with VisualKopasu. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>{{title}}</title>
		<link rel="stylesheet" href="/static/css/redmond/jquery-ui-1.9.0.custom.min.css" />
		<link rel="stylesheet" href="/static/css/visualkopasu.css" />
		<script type="text/javascript" src="/static/js/jquery-1.8.2.min.js"></script>
		<script src="/static/js/jquery-ui-1.9.0.custom.min.js"></script>
		
		<script type="text/javascript">
			$(document).ready(function() {
		        initialise();
			});
			
			function initialise(){
				$("#btnShowCorpus").button().click(function(){
					window.location = "/";			
					//return false;
				});
				$("#btnShowXML").button().click(function(){
					window.open("/original/?ident={{sentence_ident}}");			
				});
				$("#btnSearch").button();
				$("#form_search").submit(function(){
					if($("#user_query").val().length == 0){
						alert("Please enter your query");
						return false;						
					}
				});
			}
		</script>	
	</head>

	<body>
		<div id="banner" class="ui-widget-header ui-corner-all">
		{{header}}
		</div>
		
		<form id="form_search" action="/search/" method="post">
		{% csrf_token %}
			<div id="toolbar" class="ui-corner-all">
				<button type="button" id="btnShowCorpus" name="btnShowCorpus">Show Corpus</button>
				<span class="toolbar_label">Search</span>
				<input id="user_query" name="user_query" {% if user_query %}value="{{user_query}}"{% endif %} style="width: 500px" />
				<button type="submit" id="btnSearch" name="btnSearch">Quick Search</button>
			</div>
		</form>		
		
		
		<div class="ui-widget">
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 10px; padding: 0 .7em;">
				<p>
				<span class="ui-icon ui-icon-info" style="float:left; margin-right:.3em;"> </span>
				<strong>Search option:</strong>
				C:[Carg] (e.g. C:Linus C:Bazaar) or L:[lemma] (e.g. L:subversive L:rose), G:gpred (G:named_rel)<br/>
				([from_node] [LINK_POST]/[RARGNAME] [to_node])
				</p>
			</div>
		</div>

		{% if search_results %}
		<div class="search_statistics">
			{{search_statistics}}
		</div>
		<ul>
			{% for sentence in search_results %}
			<li>
			{{sentence.text}}<br/>
				{% for representation in sentence.representations %}
					{% if forloop.counter <= 10 %}
					<a href="/dmrs/?search_id={{representation.search_ID}}" target="visualkopasu_searchresult">{{representation.ID}}</a>
					{% elif forloop.last %}
					...
					{% endif %}
				{% endfor %}
			{% endfor %}
			</li>
		</ul>
		{% elif user_query %}
			No results.
		{% endif %}
	</body>
</html>
